<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
<%@include file="../common/includeBaseSet.jsp" %>
<%@include file="../../common/includeSystemSet.jsp" %>
<%@include file="../../common/operation_forbid.jsp" %>
<link rel="stylesheet" type="text/css"  href="${jypath}/static/ext/resources/ext-theme-gray/ext-theme-gray-all.css" />
<script type="text/javascript" src="${jypath}/static/ext/ext-all.js"></script>
<script type="text/javascript" src="${jypath}/static/ext/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="${jypath}/static/js/components/roomInfoComponent.js"></script> 
<script type="text/javascript">
    var maketingRetainAdd=true;
    var marketingPayDepositAdd=true;
    var marketingSubscribeAdd=true;
    var marketingSignedAdd=true;
    var marketingSellControlAdd=true;
	$(function(){
		getList();
	});
	
	var dicName="${dicName}";
	
    function messageJump(id,type){
        if(type=="1"){
            //跳转房源
        	var windowInfo = Ext.create('component.room.InfoWindow',{
				 roomId:id
			 });
			 windowInfo.show();
        }else if(type=="2"){
            //跳转客户详情
            var openUrl="${jypath}/customer/customer/toDetail?resourcesCode=menu_0003_0001&customerId="+id;
            window.open(openUrl);
        }else if(type=="3"){
            //跳转价格方案详情
             var openUrl="${jypath}/marketing/priceScheme/schemeView?id="+id;
             window.open(openUrl);
        }
    }
    var json={};
    function handleTodo(i){
//     	jypath+"/processComponent/index?jumpUrl="+formKey+"&id="+id+"&taskId="+taskId;
//     	window.open(openUrl);
//     	var openUrl = jypath+"/processComponent/index?jumpUrl=";
//     	if(dicName=="审核申请"){
// 			 if(null!=l.taskId && l.taskId!=""){
// 				 html+="<td class='center'><a onclick='handleTodo(&apos;"+l.formKey+"&apos;,&apos;"+l.businessKey+"&apos;,&apos;"+l.taskId+"&apos;)'>查看</a></td>"; 
//             } else{
//            	 	 html+="<td class='center'></td>"; 
//             } 
// 		}
    	var openUrl = jypath;
    	if(dicName=="审核申请" || dicName=="审核结果"){
			if(null!=json[i].taskId && json[i].taskId!="" && json[i].taskId!="null"){
				 openUrl += "/processComponent/index?jumpUrl="+json[i].formKey+"&id="+json[i].businessKey+"&taskId="+json[i].taskId;
			}else{
            	 openUrl += json[i].formKey+"&id="+json[i].businessKey+"&processFlag=processHistoryShow";
            }
			window.open(openUrl);
		}else if(dicName=="逾期未签约"){
			openUrl += "/customer/subscribe/toView?id="+json[i].businessId+"&returnUrl="+json[i].formKey+"&processFlag=false";
			window.open(openUrl);
		}else if(dicName=="逾期未付款"){
			openUrl += "/customer/signed/toView?id="+json[i].businessId+"&returnUrl="+json[i].formKey+"&processFlag=false";
			window.open(openUrl);
		}else if(dicName=="客户维护" && json[i].noticeTempType=="NT46"){
			openUrl += "/customer/customer/toDetail?customerId="+json[i].customerId+"&projectId="+json[i].projectId+"&businessId="+json[i].businessId+"&resourcesCode=menu_0003_0001"
			window.open(openUrl);
		}
    }

	function getList(){
		JY.Model.loading();
		JY.Ajax.doRequest("baseForm",jypath +'/system/notice/queryNoticeListLC',{dictionaryName:'${dicName}'},function(data){
			 $("#baseTable tbody").empty();
			 var page = data.obj;
			 //数据集合
        	 var results = page.rows;
        	 //分页数据
         	 var pageNum = page.pageNumber;
        	 var pageSize = page.pageSize
        	 var totalRecord = page.total;
         	 var permitBtn=[
     	       		  {name:"修改",btnFun:"edit",icon:"icon-edit color-blue"},
     	       		  {name:"删除",btnFun:"del",icon:"icon-remove-sign color-red"},
     	       		 ];
        	 var html="";
        	 if(results!=null && results.length>0){
        		 var leng=(pageNum-1)*pageSize;//计算序号
        		 for(var i = 0;i<results.length;i++){
        			 var l=results[i];
        			 console.log(l);
        			 json[i] = results[i];
        			 //html+="<tr style='cursor:pointer' onDblClick='handleTodo(&apos;"+l.formKey+"&apos;,&apos;"+l.businessKey+"&apos;,&apos;"+l.taskId+"&apos;,&apos;"+l.businessId+"&apos;)'>";
        			 if(dicName=="审核申请" || dicName=="审核结果" || dicName=="逾期未签约" 
        					 || dicName=="逾期未付款" || (dicName=="客户维护" && json[i].noticeTempType=="NT46")){
        				 html+="<tr style='cursor:pointer' onDblClick='handleTodo("+i+")'>";
        			 }else{
        				 html+="<tr>";
        			 }
        			 if(JY.Object.notEmpty(l.noticeTypeName)!=""){
                         html+="<td class='center' style='width: 200px;'>"+l.noticeTypeName+"</td>";
                     }else{
                         html+="<td class='center' style='width: 200px;'>${dicName}</td>";
                     }
        			 html+="<td class='left'>"+JY.Object.notEmpty(l.content)+"</td>"
        			 html+="<td style='width: 120px;'>"+JY.Object.notEmpty(new Date(l.issueTime).Format("yyyy-MM-dd"))+"</td>"
        			 html+="</tr>";
        		 }
        		 $("#baseTable tbody").append(html);
        		 JY.Page.setPage("baseForm","pageing",pageSize,pageNum,totalRecord,"getList");
			}else{
				html+="<tr><td colspan='3' class='center'>没有相关数据</td></tr>";
        		$("#baseTable tbody").append(html);
        		$("#pageing ul").empty();//清空分页
       	 	}
			JY.Model.loadingClose();
		});
	}
</script>
<title>消息提醒</title>
</head>
<body>
<div class="page-content">
	<div class="row-fluid">	
		<div class="col-xs-12">
			<form id="baseForm" class="form-inline" method="POST" onsubmit="return false;">
				<input type='hidden' class='pageNum' name='pageNum' value='1'/>
				<input type='hidden' class='pageSize'  name='pageSize' value='10'/>
			</form>
 			<table id="baseTable" class="table table-striped table-bordered table-hover" >
				<thead>
					<tr>
					    
						<th  class="center">类别</th>
						<th  class="center">详情</th>
						<th  class="center">发生时间</th>
<%-- 						<c:if test="${dicName eq '审核申请' }"><th  class="center">操作</th></c:if> --%>
					</tr>
				</thead>
				<tbody></tbody>
			</table>
			<div class="row">
				<div class="col-sm-12">
				<!--设置分页位置-->
					<div id="pageing" class="dataTables_paginate paging_bootstrap">
						<ul class="pagination"></ul>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
</html>